# 4.5.1元组的创建方式
# 1.使用圆括号“()”创建元组
tu_one = ()                      #空元组
tu_two = (1,)                    #元组中只有一个元素
tu_three = ('t','u','p','l','e') #元组中元素类型均为字符串类型
tu_four = (0.3, 1,'python',True) #元组中元素不同

# 2.使用tuple()创建元组
tuple_null = tuple()
print(tuple_null)
tuple_str = tuple('abc')
print(tuple_str)
tuple_list = tuple([1,2,3])
print(tuple_list)

# 4.5.2访问元组元素
# 1.使用索引访问单个元素
tuple_demo = ('hellp',100,'python')
print(tuple_demo[0])
print(tuple_demo[1])
print(tuple_demo[2])

# 2.使用切片访问元组元素
exam_tuple = ('h','e','l','l','o')
print(exam_tuple[1:4])
